package com.happyfamily.springboot.crowdsourcingplatform.controller.pan;

import com.happyfamily.springboot.crowdsourcingplatform.annotation.OperationLogDetail;
import com.happyfamily.springboot.crowdsourcingplatform.base.result.Results;
import com.happyfamily.springboot.crowdsourcingplatform.enums.OperationType;
import com.happyfamily.springboot.crowdsourcingplatform.enums.OperationUnit;
import com.happyfamily.springboot.crowdsourcingplatform.model.Orders;
import com.happyfamily.springboot.crowdsourcingplatform.model.SysUser;
import com.happyfamily.springboot.crowdsourcingplatform.service.pan.SuccessCaseService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @Author Administrator
 * @create 2020/03/01 14:30
 */
@Controller
@RequestMapping("/successCaseFront/")
public class frontSuccessController
{

	@Autowired
	private SuccessCaseService successCaseService;

	/**
	 * 在主页展示成功案例的数据
	 * @param
	 * @return
	 */
	@GetMapping("successOrders")
	@ResponseBody
	@ApiOperation(value = "成功案例获取", notes = "查询类型是订单表数据", httpMethod = "GET", response = List.class)
	@OperationLogDetail(detail = "成功案例获取", level = 1, operationUnit = OperationUnit.USER, operationType = OperationType.SELECT)
	public List<Orders> getCessOrders()
	{

		//获取成功案例的数据
		//		List<Orders>list=successCaseService.getAllFindOrders();


		//		model.addObject("orders",list);
		return successCaseService.getAllFindOrders();

	}



	/**
	 * 跳转成功案例页面
	 *
	 * @param
	 * @return
	 */
	@GetMapping("JumpCase")
	//	@PreAuthorize("hasAuthority('sys:user:add')")
	//	@ApiOperation(value = "用户新增页面", notes = "跳转到新增用户信息页面")//描述
	public String addUser(Model model)
	{
		model.addAttribute(new SysUser());
		return "frontPage/Success-Case";

	}



}
